package sjjg.graph;

public class Edge implements Comparable<Edge>{
    private int v;
    private int w;
    private double weight;

    public Edge(int v, int w, double weight) {
        this.v = v;
        this.w = w;
        this.weight = weight;
    }
    public double weight(){
        return weight;
    }
    public int either(){
        return v;
    }
    public int another(int vx){
        return vx==v?w:v;
    }
    @Override
    public int compareTo(Edge that) {
           if(this.weight>that.weight){
               return 1;
           }else if(this.weight<that.weight){
               return -1;
           }else {
               return  0;
           }
    }
}
